package cachemanager;

import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.config.CacheConfiguration;
import net.sf.ehcache.config.PersistenceConfiguration;
import net.sf.ehcache.store.MemoryStoreEvictionPolicy;

/**
 * Created by luoqifei on 2016/9/14.
 */
public class CacheService {
    private CacheManager cacheManager;
    private Cache cache;
    public CacheService(){
        this.cacheManager = new CacheManager();
    }
    public CacheManager getCacheManager() {
        return cacheManager;
    }
    public void createCache(CacheConfiguration conf){
         this.cache = new Cache(conf);
        this.cacheManager.addCache(cache);
    }
    public Cache getCache(){
        return this.cache;
    }
}
